//
//  Bubble.m
//  UnderTheSea
//
//  Created by Thi Huynh on 4/11/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "Bubble.h"

@implementation Bubble

-(id) init
{
	return [self initWithTotalParticles:20];
}

-(id)initBubbleWithColor:(ccColor3B)color WithPosisiton:(CGPoint)position
{
    if( (self=[super initWithTotalParticles:15]) ) 
    {
        
		// duration
		duration = kCCParticleDurationInfinity;
		
		self.emitterMode = kCCParticleModeGravity;
        
		// Gravity Mode: gravity
		self.gravity = ccp(0,0);
		
		// Gravity Mode: speed of particles
		self.speed = 40;
		self.speedVar = 30;
		
		// Gravity Mode: radial
		self.radialAccel = 0;
		self.radialAccelVar = 0;
		
		// Gravity Mode: tagential
		self.tangentialAccel = 0;
		self.tangentialAccelVar = 0;
		
		// angle
		//angle = 270;
		//angleVar = 10;
        
		// emitter position
		self.position = ccp(position.x, position.y);
		posVar = CGPointZero;
		
		// life of particles
		life = 1.5;
		lifeVar = 2.0f;
		
		// size, in pixels
		startSize = 15;
		startSizeVar = 10;
        
		endSize = 2;
        
		// emits per second
		emissionRate = totalParticles/duration;
		
		// color of particles
		startColor.r = color.r;
		startColor.g = color.g;
		startColor.b = color.b;
		startColor.a = 1.0f;

		
		self.texture = [[CCTextureCache sharedTextureCache] addImage:@""];
        
		// additive
		self.blendAdditive = YES;
	}
	
	return self;
}

-(id)initBubbleForMenu:(ccColor3B)color WithPosisiton:(CGPoint)position
{
    if( (self=[super initWithTotalParticles:15]) ) 
    {
        
		// duration
		duration = kCCParticleDurationInfinity;
		
		self.emitterMode = kCCParticleModeGravity;
        
		// Gravity Mode: gravity
		self.gravity = ccp(0,0);
		
		// Gravity Mode: speed of particles
		self.speed = 40;
		self.speedVar = 30;
		
		// Gravity Mode: radial
		self.radialAccel = 0;
		self.radialAccelVar = 0;
		
		// Gravity Mode: tagential
		self.tangentialAccel = 0;
		self.tangentialAccelVar = 0;
		
		// angle
		//angle = 270;
		//angleVar = 10;
        
		// emitter position
		self.position = ccp(position.x, position.y);
		posVar = CGPointZero;
		
		// life of particles
		life = 1.5;
		lifeVar = 2.0f;
		
		// size, in pixels
		startSize = 15;
		startSizeVar = 10;
        
		endSize = 2;
        
		// emits per second
		emissionRate = totalParticles/duration;
		
		// color of particles
		startColor.r = color.r;
		startColor.g = color.g;
		startColor.b = color.b;
		startColor.a = 1.0f;
        
		
		self.texture = [[CCTextureCache sharedTextureCache] addImage: @""];
        
		// additive
		self.blendAdditive = YES;
	}
	
	return self;
    
}

@end
